// import ReactDOM from 'react-dom';
import React from 'react';

class Test  extends React.Component {
  constructor(props){
    super(props)
    
    this.state = {
      moeny:100
    }
  }




  // 组件渲染完成
  componentDidMount(){
    console.log('组件渲染完成了');
    setInterval(() => {
      // this.state.moeny++
      // console.log(this.state.moeny);

      
      this.setState({
        moeny:this.state.moeny+1
      })


    }, 1000);
  }

  
  render(){
    // console.log(this.props);
    let name = this.props.name
 
    return (
      <div>
        <div>我是一个类组件 {name} 哈哈哈</div>
        <div>我有{this.state.moeny}块钱</div>
      </div>

    )
  }
}

/* 
function Test (props){

  console.log(props);
  return <div>我是一个类组件 哈哈哈</div>

} */

export default Test
